package libsys.general;

public class ListenerAdder
{
		LIBSYSSystem LibrarySystem;
		
		public ListenerAdder(LIBSYSSystem LibrarySystem)
		{
				this.LibrarySystem = LibrarySystem;
		}
		
		public void addListeners()
		{
				addTreeListeners();
				addButtonListeners();				
				addMainMenuBarListeners();				
				addWindowListeners();
				addComponentListeners();
		}
		
		private void addComponentListeners()
		{
				LibrarySystem.FrameItems.settingsFontsAndColorsPanelItems.fontfacelist_combobox.addItemListener(LibrarySystem.listeners.FontItemsListener);
				LibrarySystem.FrameItems.settingsFontsAndColorsPanelItems.fontstyle_combobox.addItemListener(LibrarySystem.listeners.FontItemsListener);
				
				LibrarySystem.FrameItems.settingsFontsAndColorsPanelItems.fontsize_spinner.addChangeListener(LibrarySystem.listeners.FontSpinnerListener);
		}
		
		private void addWindowListeners()
		{
				LibrarySystem.FrameList.CalculatorFrame.addWindowListener(LibrarySystem.listeners.CalculatorWindowHideListener);
				LibrarySystem.FrameList.SettingsFrame.addWindowListener(LibrarySystem.listeners.SettingsWindowHideListener);
		}
		
		private void addButtonListeners()
		{
				addCalculatorButtonListeners();
				addSettingsButtonListeners();
		}
		
		private void addTreeListeners()
		{
				LibrarySystem.FrameItems.navigationFrameItems.navigation_tree.addTreeSelectionListener(LibrarySystem.listeners.treeListeners.navigationTreeListener);
				LibrarySystem.FrameItems.settingsFrameItems.settings_tree.addTreeSelectionListener(LibrarySystem.listeners.treeListeners.settingsTreeListener);
		}
		
		private void addSettingsButtonListeners()
		{
				LibrarySystem.FrameItems.settingsFontsAndColorsPanelItems.fontcolor_btn.addActionListener(LibrarySystem.listeners.buttonListeners.settingsFontsAndColorsChangePanelButtonListener);
				LibrarySystem.FrameItems.settingsFontsAndColorsPanelItems.applychanges_btn.addActionListener(LibrarySystem.listeners.buttonListeners.settingsFontsAndColorsChangePanelButtonListener);
		}
		
		private void addMainMenuBarListeners()
		{
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.logoff_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.lock_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.exit_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.addaccount_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.editaccount_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.deleteaccount_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.startdatabaseserver_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.stopdatabaseserver_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.connectdatabaseserver_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.backupbooksdatabase_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.backupborrowersdatabase_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.backuptransactionsdatabase_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.backupfinesdatabase_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.backupentiredatabase_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.loadbooksdatabase_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.loadborrowersdatabase_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.loadtransactionsdatabase_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.loadfinesdatabase_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.loadentiredatabase_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.querybrowser_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.calculator_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.settings_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);				
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.clearsystemlog_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.helpcontents_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
				LibrarySystem.FrameItems.navigationFrameItems.MainMenuBar.aboutlibsys_menuitem.addActionListener(LibrarySystem.listeners.mainMenuBarListener);
		}		
		
		private void addCalculatorButtonListeners()
		{
				LibrarySystem.FrameItems.calculatorFrameItems.zero_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.one_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.two_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.three_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.four_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.five_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.six_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.seven_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.eight_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.nine_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.plus_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.minus_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.multiply_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.divide_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.openbrace_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.closebrace_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.percentage_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.point_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.clear_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
				LibrarySystem.FrameItems.calculatorFrameItems.backspace_btn.addActionListener(LibrarySystem.listeners.buttonListeners.calculatorButtonListener);
		}	
}

